
<div class="content">
	<div class="content_i">
		<?php
           
			  // Thong tin dang nhap
            echo "<h2>";
				echo CHtml::image(Yii::app()->baseUrl."/assets/icon/icon-16-info.png");
				echo " ";
				echo "<strong>Thông tin Shortcut</strong>";
			echo "</h2>";
			
			
            echo CHtml::beginForm(
				array($this->controller_id."/save","shortcut_id"=>$row["id"],"page"=>$page),
				"post",
				array("id"=>"form_edit")
			);
            
          
            echo "<table cellpadding='3' cellspacing='0 border='0' width='50%'>";
                echo "<tr>";
                    echo "<td class='label' width='120'>"."Tên Shortcut"."</td>";
                    echo "<td>";
                         echo CHtml::textField("name", $row["name"], array('style'=>'width:400px'));
                        
                    echo "</td>";
                echo "</tr>";
                
                echo "<tr>";
                    echo "<td class='label' width='100'>"."Thứ tự"."</td>";
                    echo "<td>";
                    echo CHtml::textField("order", $row["order"], array('style'=>'width:400px'));
                    echo "</td>";
                echo "</tr>";
				
				echo "<tr>";
                    echo "<td class='label' width='100'>"."Admin Menu"."</td>";
                    echo "<td>";
                    	$list_adminmenu = array();
						$adminemnu_array = adminmenu::model()->findAll(array(
							"condition" => "parent_id = 0 AND enable = 1",
							"order" => "`order` ASC"
						));
						foreach($adminemnu_array as $adminmenu)
						{
							$list_adminmenu[$adminmenu->id] = $adminmenu->name_default;
							$sub_adminmenu_array = adminmenu::model()->findAll(array(
								"condition" => "enable = 1 AND parent_id = " . $adminmenu->id,
								"order" => "`order` ASC"
							));
							foreach($sub_adminmenu_array as $sub_adminmenu)
								$list_adminmenu[$sub_adminmenu->id] = "... " .$sub_adminmenu->name_default;
						}
						
						echo CHtml::dropDownList("adminmenu_id", $row->adminmenu_id, $list_adminmenu);
                    echo "</td>";
                echo "</tr>";
				
				echo "<tr>";
				echo "<td>"."</td>";
				echo "<td>";
				
					// Submit Button
					echo "<div class='space_5'></div>";

					echo 
						"<div class='button' id='button_submit'>" .
							"<div style='float:left; width:20px;'>" .
								CHtml::image(Yii::app()->baseUrl."/assets/icon/icon-16-save.png") .
							"</div>" .
							"<div style='float:left; min-width:40px;font-weight:bold'>".
								"Save" .
							"</div>" .
						"</div>";
					echo 
						"<div class='button' id='button_savenew'>" .
							"<div style='float:left; width:20px;'>" .
								CHtml::image(Yii::app()->baseUrl."/assets/icon/icon-16-plus.png") .
							"</div>" .
							"<div style='float:left; min-width:40px;font-weight:bold'>".
								" Save & New" .
							"</div>" .
						"</div>";
					
					echo 
						"<div class='button' id='button_apply'>" .
							"<div style='float:left; width:20px;'>" .
								CHtml::image(Yii::app()->baseUrl."/assets/icon/icon-16-tick.png") .
							"</div>" .
							"<div style='float:left; min-width:40px;font-weight:bold'>".
								" Apply" .
							"</div>" .
						"</div>";
						
						
					echo 
						"<div class='button' id='button_cancel'>" .
							"<div style='float:left; width:20px;'>" .
								CHtml::image(Yii::app()->baseUrl."/assets/icon/icon-16-check.png") .
							"</div>" .
							"<div style='float:left; min-width:50px;font-weight:bold'>".
								"Cancel" .
							"</div>" .
						"</div>";
					
				echo "</td>";
			echo "</tr>";
            echo "</table>";
			
            echo CHtml::endForm();
        ?>
	</div><!-- end div content_i -->
</div><!-- end div content -->

<script language="javascript">
$(document).ready(function(){
	$('#button_submit').click(function(){
		$('#form_edit').submit();
	});
	
	$('#button_savenew').click(function(){
		$('#form_edit').attr("action","<?php
			echo Yii::app()->createUrl(
				$this->module_id."/" . $this->controller_id."/savenew",
				array("shortcut_id"=>$row["id"],"page"=>$page)
			);
		?>");
		$('#form_edit').submit();
	});
	
	$('#button_apply').click(function(){
		$('#form_edit').attr("action","<?php
			echo Yii::app()->createUrl(
				$this->module_id."/" . $this->controller_id."/apply",
				array("shortcut_id"=>$row["id"],"page"=>$page)
			);
		?>");
		$('#form_edit').submit();
	});
	
	
	$('#button_cancel').click(function(){
		//$('#form_edit').submit();
		window.location = '<?php
			$url = Yii::app()->createUrl(
				$this->route . "/view",
				array("page" =>$page)
			);
			echo $url;
		?>';
	});
});
</script>